home *** CD-ROM | disk | FTP | other *** search
- /*
- * table binding keys to microEmacs functions
- */
- #include "keynames.h"
-
- typedef struct {
- short k_code; /* Key code */
- int (*k_fp)(); /* Routine to handle it */
- } KEYBIND;
-
- extern int ctrlg(); /* Abort out of things */
- extern int quit(); /* Quit */
- extern int ctlxlp(); /* Begin macro */
- extern int ctlxrp(); /* End macro */
- extern int ctlxe(); /* Execute macro */
- extern int fileread(); /* Get a file, read only */
- extern int filevisit(); /* Get a file, read write */
- extern int filewrite(); /* Write a file */
- extern int filesave(); /* Save current file */
- extern int filename(); /* Adjust file name */
- extern int getccol(); /* Get current column */
- extern int gotobol(); /* Move to start of line */
- extern int forwchar(); /* Move forward by characters */
- extern int gotoeol(); /* Move to end of line */
- extern int backchar(); /* Move backward by characters */
- extern int forwline(); /* Move forward by lines */
- extern int backline(); /* Move backward by lines */
- extern int forwpage(); /* Move forward by pages */
- extern int backpage(); /* Move backward by pages */
- extern int gotobob(); /* Move to start of buffer */
- extern int gotoeob(); /* Move to end of buffer */
- extern int setfillcol(); /* Set fill column. */
- extern int setmark(); /* Set mark */
- extern int swapmark(); /* Swap "." and mark */
- extern int forwsearch(); /* Search forward */
- extern int backsearch(); /* Search backwards */
- extern int showcpos(); /* Show the cursor position */
- extern int nextwind(); /* Move to the next window */
- extern int prevwind(); /* Move to the previous window */
- extern int onlywind(); /* Make current window only one */
- extern int splitwind(); /* Split current window */
- extern int mvdnwind(); /* Move window down */
- extern int mvupwind(); /* Move window up */
- extern int enlargewind(); /* Enlarge display window. */
- extern int shrinkwind(); /* Shrink window. */
- extern int listbuffers(); /* Display list of buffers */
- extern int usebuffer(); /* Switch a window to a buffer */
- extern int killbuffer(); /* Make a buffer go away. */
- extern int reposition(); /* Reposition window */
- extern int refresh(); /* Refresh the screen */
- extern int twiddle(); /* Twiddle characters */
- extern int tab(); /* Insert tab */
- extern int newline(); /* Insert CR-LF */
- extern int indent(); /* Insert CR-LF, then indent */
- extern int openline(); /* Open up a blank line */
- extern int deblank(); /* Delete blank lines */
- extern int quote(); /* Insert literal */
- extern int backword(); /* Backup by words */
- extern int forwword(); /* Advance by words */
- extern int forwdel(); /* Forward delete */
- extern int backdel(); /* Backward delete */
- extern int kill(); /* Kill forward */
- extern int yank(); /* Yank back from killbuffer. */
- extern int upperword(); /* Upper case word. */
- extern int lowerword(); /* Lower case word. */
- extern int upperregion(); /* Upper case region. */
- extern int lowerregion(); /* Lower case region. */
- extern int capword(); /* Initial capitalize word. */
- extern int delfword(); /* Delete forward word. */
- extern int delbword(); /* Delete backward word. */
- extern int killregion(); /* Kill region. */
- extern int copyregion(); /* Copy region to kill buffer. */
- /*
- extern int spawncli(); /* Run CLI in a subjob. *
- extern int spawn(); /* Run a command in a subjob. *
- */
- extern int quickexit(); /* low keystroke style exit. */
-
-
- /*
- * Command table.
- * This table is *roughly* in ASCII order, left to right across the
- * characters of the command. This expains the funny location of the
- * control-X commands.
- */
- KEYBIND keybind[] = {
- CTRL|'@', &setmark,
- CTRL|'A', &gotobol,
- CTRL|'B', &backchar,
- /* CTRL|'C', &spawncli, run CLI in subjob. */
- CTRL|'D', &forwdel,
- CTRL|'E', &gotoeol,
- CTRL|'F', &forwchar,
- CTRL|'G', &ctrlg,
- CTRL|'H', &backdel,
- CTRL|'I', &tab,
- CTRL|'J', &indent,
- CTRL|'K', &kill,
- CTRL|'L', &refresh,
- CTRL|'M', &newline,
- CTRL|'N', &forwline,
- CTRL|'O', &openline,
- CTRL|'P', &backline,
- CTRL|'Q', "e, /* Often unreachable */
- CTRL|'R', &backsearch,
- CTRL|'S', &forwsearch, /* Often unreachable */
- CTRL|'T', &twiddle,
- CTRL|'V', &forwpage,
- CTRL|'W', &killregion,
- CTRL|'Y', &yank,
- CTRL|'Z', &quickexit, /* quick save and exit */
-
-
- F1, &delbword, /* delete preceding word */
- F2, &delfword, /* delete the next/current word */
- F3, &kill, /* kill current line to its end */
- F4, &yank, /* insert the deleted stuff back */
- F5, &killbuffer, /* kill [current] buffer; verifies if changed */
- F6, &listbuffers, /* list buffers, and their sizes; not accurate */
- F7, &usebuffer, /* switch to another existing/new buffer */
- F8, &filewrite, /* save current buffer to specified file */
- F9, &filevisit, /* read-in a file to edit */
- F10, &filesave, /* save current buffer to its file */
-
- HELP, &help, /* alas, not much help yet! */
- UNDO, &quickexit, /* quick save and exit */
- INSERT, &backpage, /* display page preceding current one */
- HOME, &forwpage, /* display page following current one */
- UPARRO, &backline, /* move cursor to preceding line; readjust displ*/
- DNARRO, &forwline, /* move cursor to next line; readjust display */
- LTARRO, &backchar, /* move cursor to preceding char */
- RTARRO, &forwchar, /* move cursor to following char */
-
- /*
- keypad keys
- ----------- */
- KLP, &mvdnwind, /* scroll window contents up (move window down) */
- KRP, &mvupwind, /* scroll window contents dn (move window up) */
- KSLASH, &splitwind, /* split current window into two */
- KSTAR, &onlywind, /* make the current window the only one */
- KMINUS, &prevwind, /* move cursor to preceding window, if any */
- KPLUS, &nextwind, /* move cursor to following window, if any */
- KENTER, &ctlxe, /* re-execute the key-board macro */
- KDOT, &swapmark, /* swap mark with dot; (shift-F1 sets mark) */
- K0, &showcpos, /* show cursor position numerically */
-
-
- K7, &gotobob, /* move cursor to beginning of buffer */
- K8, &reposition, /* reposition so that current line is at the top*/
- K9, &gotoeob, /* move cursor to end of buffer */
- K4, &backword, /* move cursor to beginning of word */
- K5, &backline, /* move to prev line; same as up arrow */
- K6, &forwword, /* move cursor to end of word */
- K1, &gotobol, /* move cursor to beginning of current line */
- K2, &forwline, /* move to next line; same as dn arrow */
- K3, &gotoeol, /* move cursor to end of current line */
- CTLX|CTRL|'B', &listbuffers,
- CTLX|CTRL|'C', &quit, /* Hard quit. */
- CTLX|CTRL|'F', &filename,
- CTLX|CTRL|'L', &lowerregion,
- CTLX|CTRL|'O', &deblank,
- CTLX|CTRL|'N', &mvdnwind,
- CTLX|CTRL|'P', &mvupwind,
- CTLX|CTRL|'R', &fileread,
- CTLX|CTRL|'S', &filesave, /* Often unreachable */
- CTLX|CTRL|'U', &upperregion,
- CTLX|CTRL|'V', &filevisit,
- CTLX|CTRL|'W', &filewrite,
- CTLX|CTRL|'X', &swapmark,
- CTLX|CTRL|'Z', &shrinkwind,
- /* CTLX|'!', &spawn, Run 1 command. */
- CTLX|'=', &showcpos,
- CTLX|'(', &ctlxlp,
- CTLX|')', &ctlxrp,
- CTLX|'1', &onlywind,
- CTLX|'2', &splitwind,
- CTLX|'B', &usebuffer,
- CTLX|'E', &ctlxe,
- CTLX|'F', &setfillcol,
- CTLX|'K', &killbuffer,
- CTLX|'N', &nextwind,
- CTLX|'P', &prevwind,
- CTLX|'Z', &enlargewind,
- META|CTRL|'H', &delbword,
- META|'!', &reposition,
- META|'.', &setmark,
- META|'>', &gotoeob,
- META|'<', &gotobob,
- META|'B', &backword,
- META|'C', &capword,
- META|'D', &delfword,
- META|'F', &forwword,
- META|'L', &lowerword,
- META|'U', &upperword,
- META|'V', &backpage,
- META|'W', ©region,
- META|0x7F, &delbword,
- 0x7F, &backdel
- };
-
- #define NKEYBIND (sizeof(keybind)/sizeof(keybind[0]))
-
- int nkeybind = NKEYBIND;
-
- /* -eof- */
-